/*
 * @copyright: Huang Ding
 * @Author: ding-cx
 * @Date: 2021-02-21 08:39:50
 * @LastEditors: ding-cx
 * @LastEditTime: 2021-03-22 18:13:09
 * @Description: file content
 */
import { Application, IBoot } from "egg";

// 导入WebSocket模块:
// import * as WebSocket from "ws";

export default class AppInitBoot implements IBoot {
  private readonly app: Application;

  constructor(app: Application) {
    this.app = app;
    // console.log(process.pid);

    this.app.once("server", () => {
      // console.log(server);
      // console.log(process.pid);
    });
  }



  async willReady() {
    // console.log(this.app.config.env);
    //local本地开发环境执行一次sync，将模型入数据库。
    if (this.app.config.env !== "prod") {
      // await this.app.model.Sys.Oss.sync({ force: true });
      // await this.app.model.sync({ force: true });
    }
  }
}
